package com.aspire.moss.portal.view;

import android.graphics.Bitmap;

/**
 * 保存一个应用的详细信息
 * @author Administrator
 *
 */
public class AppInfo extends ItemInfo implements Cloneable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * 图标
	 */
	public Bitmap iconBitmap;
	
	/**
	 * 标题
	 */
	public String title;
	
	/**
	 * 是否已安装 , 是否有更新
	 */
	public boolean isInstall ,isUpdate;

	public AppInfo(Bitmap iconBitmap, String title) {
		super();
		this.iconBitmap = iconBitmap;
		this.title = title;
	}
	
	public AppInfo(int screen ,int cellX, int cellY , Bitmap iconBitmap, String title) {
		super(screen ,cellX , cellY);
		this.iconBitmap = iconBitmap;
		this.title = title;
	}
	
	/**
	 * 比较两个对象是否在同一个位置
	 * @param appInfo
	 * @return
	 */
	public boolean eqXYScreen(AppInfo appInfo) {
		if (this.cellX == appInfo.cellX && this.cellY == appInfo.cellY
				&& this.screen == appInfo.screen){
			return true;
		}
		return false;
	}
	
	
	@Override
	protected Object clone() throws CloneNotSupportedException {
		final AppInfo appInfo = (AppInfo) super.clone();
		appInfo.screen = screen;
		appInfo.cellX = cellX;
		appInfo.cellY = cellY;
		appInfo.iconBitmap = iconBitmap;
		appInfo.isInstall = isInstall;
		appInfo.isUpdate= isUpdate;
		appInfo.title= title;
		appInfo.tag = tag;
		return appInfo;
	}

	@Override
	public String toString() {
		return super.toString() 
			+ " iconBitmap=" + iconBitmap
			+ " title=" + title
			+ " isInstall=" + isInstall
			+ " isUpdate=" + isUpdate;
	}
}
